package com.usf.jprovider.schema.connector;

import com.usf.jprovider.constants.Constants;

public final class OracleConnector extends AbstractConnector {

	public OracleConnector() {
		super(Constants.ORACLE_DRIVER);
	}

	@Override
	public String IntegerFormater(String value) {
		return "'" + value + "'";
	}
	@Override
	public String DoubleFormater(String value) {
		return "'" + value + "'";
	}
	@Override
	public String DateFormater(String value, String format) {
		return "to_date('" + value + "','" + format + "')";
	}
	@Override
	public String StringFormater(String value) {
		return "'" + value + "'";
	}
	@Override
	public String FileSourceFormater(String value) {
		return "'" + value + "'";
	}

	@Override
	public String selectRandomize(String table, String column) {
		 return "SELECT DISTINCT " + column + " FROM " + table + 
				 " ORDER BY dbms_random.value";
	}
	@Override
	public String selectRandomize(String table, String column, String queryValue) {
		 return "SELECT DISTINCT " + column + " FROM " + table + "WHERE " + column + " " + queryValue + 
				 " ORDER BY dbms_random.value";
	}
	@Override
	public String selectRandomize(String query) {
		return query + " ORDER BY dbms_random.value";//TODO DISTINCT 
	}
	
	@Override
	public String nextSequenceQuery(String name) {
		return "SELECT " + name + ".nextval" + " FROM DUAL";
	}
}
